using System;
using System.Collections.Generic;

namespace AuthorizeNET {
	public class DecisionResponse {
		private string[] gateway_response;
		
		private string response_code;
		private string response_subcode;
		private string response_reason_code;
		private string response_reason_text;
		private string auth_code;
		private string avs_code;
		private string transaction_id;

		public DecisionResponse(String gateway_response_data) {
			this.gateway_response = gateway_response_data.Split('|');

			this.response_code = gateway_response[0];
			this.response_subcode = gateway_response[1];
			this.response_reason_code = gateway_response[2];
			this.response_reason_text = gateway_response[3];
			this.auth_code = gateway_response[4];
			this.avs_code = gateway_response[5];
			this.transaction_id = gateway_response[6];
		}

		public GatewayDecision Decision {
			get {
				return (GatewayDecision)Enum.Parse(typeof(GatewayDecision), this.response_code);
			}
		}

		public string ResponseCode {
			get { return (this.response_code); }
		}

		public string ResponseSubcode {
			get { return (this.response_subcode); }
		}

		public string ResponseReasonCode {
			get { return (this.response_reason_code); }
		}

		public string ResponseReasonText {
			get { return (this.response_reason_text); }
		}

		public string AuthorizationCode {
			get { return (this.auth_code); }
		}

		public string AvsCode {
			get { return (this.avs_code); }
		}

		public string TransactionID {
			get { return (this.transaction_id); }
		}
	}
}
